package com.otitan.la.forest.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.otitan.la.forest.system.dto.PermissionDTO;
import com.otitan.la.forest.system.entity.PermissionEntity;
import com.otitan.la.forest.system.vo.PermissionPageVO;
import com.otitan.la.forest.system.vo.PermissionVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 动作元素表
 *
 * @author jiacs
 * @email xxx
 * @date 2020-09-17 14:26:54
 */
@Mapper
public interface PermissionMapper extends BaseMapper<PermissionEntity> {

    List<Map> findPermissionByUserId(String userId);

    /**
     * 分页查询
     *
     * @param [ permissionDTO, pages]
     * @return java.util.List<com.otitan.la.forest.system.entity.PermissionEntity>
     * @throws
     * @author Sunke
     * @date 2020/9/21 0021 11:18
     */
    List<PermissionPageVO> findPageData(@Param("per") PermissionDTO per, Page<PermissionPageVO> pages);

    /**
     * 根据用户ID、应用ID  查询按钮
     *
     * @param [userId, menuCodes]
     * @return java.util.List<com.otitan.la.forest.system.entity.PermissionEntity>
     * @throws
     * @author jiachangsen
     * @date 2020/09/21 14:05
     */
    List<PermissionVO> findPermission(@Param("userId") String userId,
                                      @Param("menuCodes") Set<String> menuCodes);

    /**
     * 根据菜单ID删除按钮
     * @author jiachangsen
     * @param [ids]
     * @return int
     * @exception
     * @date 2020/09/27 10:28
     */
    int deletePermissionByMenuIds(@Param("ids") List<String> ids);
}
